home *** CD-ROM | disk | FTP | other *** search
/ Codemasters Artwork Disc ECTS 2000 ( UK) / Codemasters - Artwork Disc ECTS 2000 (UK).bin / pc / xtras / medial~1 / setfx~1.dir / Internal_24_Tracking Object.ls < prev    next >
Encoding:
Text File  |  1998-12-01  |  16.0 KB  |  538 lines

  1. property ieUpdateButton, ieFXtextlist, pSelectedList, pSelected, pSelectedMember, pSelectedCast, pOriginalEffects, pNewEffects, pDrawMethod, pOriginalDrawMethod, pSource, pSourceMember, pSourceCast, pSourcePosition, pOriginalSource, pOriginalSourcePosition, pAlphaOnly, pRelToSprite, pOriginalRelToSprite, pEffectsList, pAllEffectsList, pUpdateStage, void
  2.  
  3. on new me
  4.   global fxDisplayMember
  5.   set pSelected to void
  6.   set pSource to void
  7.   set pAllEffectsList to GetListOfAllEffects(fxDisplayMember)
  8.   if getPos(pAllEffectsList, #nullfx) then
  9.     deleteAt(pAllEffectsList, getPos(pAllEffectsList, #nullfx))
  10.   end if
  11.   getMemberNameAndCast(me)
  12.   if count(pSelectedList) > 1 then
  13.     alert("You have selected more than one AlphaMania member. Changes will affect all members, replacing any previous settings.")
  14.   end if
  15.   getMemberEffects(me)
  16.   if validMember(me) then
  17.     getSourceNameAndCast(me)
  18.   end if
  19.   updateFXtextlist(me)
  20.   set pUpdateStage to not voidp(pSelected)
  21.   set ieUpdateButton to new(script "CheckBox Button", [#sprite: 7, #cur: pUpdateStage, #active: 1, #callback: me])
  22.   return me
  23. end
  24.  
  25. on removeFromList me
  26.   global fxCurObj, fxDisplayMember
  27.   if not objectp(ieFXtextlist) then
  28.     exit
  29.   end if
  30.   set i to the pCurActive of ieFXtextlist
  31.   if (i < 1) or (i > count(the pElementList of ieFXtextlist)) then
  32.     exit
  33.   end if
  34.   set SelectedEffect to getAt(the pElementList of ieFXtextlist, i)
  35.   if findPos(GetEffectList(fxDisplayMember, SelectedEffect), SelectedEffect) > 0 then
  36.     RemoveEffect(fxDisplayMember, SelectedEffect)
  37.     clearTests(me)
  38.   end if
  39.   if not voidp(getaProp(pNewEffects, SelectedEffect)) then
  40.     deleteProp(pNewEffects, SelectedEffect)
  41.   end if
  42.   updateFXtextlist(me)
  43.   if objectp(fxCurObj) then
  44.     if the peffect of fxCurObj = SelectedEffect then
  45.       Settings()
  46.     end if
  47.   end if
  48. end
  49.  
  50. on updateFXtextlist me, newObj
  51.   set list to []
  52.   if listp(pNewEffects) then
  53.     repeat with i = 1 to count(pNewEffects)
  54.       add(list, getPropAt(pNewEffects, i))
  55.     end repeat
  56.   end if
  57.   if objectp(newObj) then
  58.     set cur to the peffect of newObj
  59.   else
  60.     set cur to void
  61.   end if
  62.   set ieFXtextlist to new(script "Text List", [#list: list, #textField: "FXlist", #textSprite: 10, #cur: cur])
  63. end
  64.  
  65. on getFXList me
  66.   if voidp(pSelected) then
  67.     set pEffectsList to []
  68.     exit
  69.   end if
  70.   tell the stage
  71.     preLoad(member pSelected)
  72.   end tell
  73.   tell the stage
  74.     set pEffectsList to GetEffectList(pSelected)
  75.   end tell
  76.   repeat with i = count(pEffectsList) down to 1
  77.     if getAt(pEffectsList, i) = #nullfx then
  78.       deleteAt(pEffectsList, i)
  79.     end if
  80.   end repeat
  81. end
  82.  
  83. on goToEffect me, effect
  84.   global fxDisplayMember
  85.   set mov to GetFXMovie(fxDisplayMember, effect)
  86.   set page to GetFXPage(fxDisplayMember, effect)
  87.   releasePuppets(8, 48)
  88.   resetDisplay()
  89.   set i to 0
  90.   set pn to the fileName of the activeWindow
  91.   if the platform contains "Mac" then
  92.     set the itemDelimiter to ":"
  93.   else
  94.     set the itemDelimiter to "\"
  95.   end if
  96.   set pn to item 1 to the number of items in pn - 1 of pn
  97.   repeat while 1
  98.     set i to i + 1
  99.     set file to getNthFileNameInFolder(pn, i)
  100.     if file = EMPTY then
  101.       alert(mov && "not found.")
  102.       exit
  103.     end if
  104.     if file = mov then
  105.       exit repeat
  106.     end if
  107.     if file = (mov & ".dir") then
  108.       exit repeat
  109.     end if
  110.     if file contains mov then
  111.       set mov to file
  112.       exit repeat
  113.     end if
  114.   end repeat
  115.   go(page, mov)
  116.   set text to EMPTY
  117.   if the number of member (string(effect) && "Help Text") > 0 then
  118.     put field (string(effect) && "Help Text") after text
  119.   end if
  120.   set fxDisplayMember to the member of sprite 23
  121.   preLoad(fxDisplayMember)
  122.   put DescribeEffect(fxDisplayMember, effect) after text
  123.   put text into field "Help Text"
  124.   refresh(ieUpdateButton)
  125. end
  126.  
  127. on getAllSelectedMembers me
  128.   set pSelecteList to []
  129.   tell the stage
  130.     if the activeCastLib > 10000 then
  131.       return []
  132.     end if
  133.     set pSelectedCast to the name of castLib the activeCastLib
  134.     set selectedMemberList to the selection of castLib the activeCastLib
  135.     repeat with x = 1 to count(selectedMemberList)
  136.       set smallList to getAt(selectedMemberList, x)
  137.       repeat with y = getAt(smallList, 1) to getAt(smallList, 2)
  138.         if the type of member y of castLib pSelectedCast = #alpha then
  139.           set pSelectedMember to the name of member y of castLib pSelectedCast
  140.           set pSelected to member y of castLib pSelectedCast
  141.           return pSelected
  142.         end if
  143.       end repeat
  144.     end repeat
  145.   end tell
  146.   return void
  147. end
  148.  
  149. on getMemberNameAndCast me
  150.   set pSelectedList to []
  151.   set pSelected to void
  152.   set pSelectedMember to EMPTY
  153.   set pSelectedCast to EMPTY
  154.   tell the stage
  155.     if the activeCastLib > 10000 then
  156.       exit
  157.     end if
  158.     set pSelectedCast to the name of castLib the activeCastLib
  159.     set selectedMemberList to the selection of castLib the activeCastLib
  160.     repeat with x = 1 to count(selectedMemberList)
  161.       set smallList to getAt(selectedMemberList, x)
  162.       repeat with y = getAt(smallList, 1) to getAt(smallList, 2)
  163.         if the type of member y of castLib pSelectedCast = #alpha then
  164.           add(pSelectedList, member y of castLib pSelectedCast)
  165.           if voidp(pSelected) then
  166.             set pSelectedMember to the name of member y of castLib pSelectedCast
  167.             set pSelected to member y of castLib pSelectedCast
  168.           end if
  169.         end if
  170.       end repeat
  171.     end repeat
  172.   end tell
  173. end
  174.  
  175. on getMemberEffects me
  176.   if voidp(pSelected) then
  177.     set list to [:]
  178.   else
  179.     tell the stage
  180.       preLoad(member pSelected)
  181.       set list to GetEffectList(pSelected)
  182.       repeat with i = 1 to count(list)
  183.         set effect to getPropAt(list, i)
  184.         set effectlist to GetEffectArgs(pSelected, effect)
  185.         setAt(list, i, effectlist)
  186.       end repeat
  187.     end tell
  188.     if findPos(list, #nullfx) then
  189.       deleteAt(list, findPos(list, #nullfx))
  190.     end if
  191.   end if
  192.   set pOriginalEffects to list
  193.   set pNewEffects to list
  194.   if not voidp(pSelected) then
  195.     tell the stage
  196.       set pDrawMethod to the drawMethod of pSelected
  197.       set pOriginalDrawMethod to the drawMethod of pSelected
  198.     end tell
  199.   end if
  200. end
  201.  
  202. on setDrawMethod me, method
  203.   set pDrawMethod to method
  204.   if not voidp(pSelected) then
  205.     tell the stage
  206.       set the drawMethod of pSelected to pDrawMethod
  207.     end tell
  208.   end if
  209. end
  210.  
  211. on setRelToSprite me, active
  212.   set pRelToSprite to active
  213.   if not voidp(pSelected) then
  214.     tell the stage
  215.       set the sourceRelToSprite of pSelected to pRelToSprite
  216.     end tell
  217.   end if
  218. end
  219.  
  220. on resetProperties me
  221.   if not voidp(pSelected) then
  222.     tell the stage
  223.       set the drawMethod of pSelected to pOriginalDrawMethod
  224.       set the sourceRelToSprite of pSelected to pOriginalRelToSprite
  225.       if pOriginalSource <> 0 then
  226.         set the sourcemember of pSelected to pOriginalSource
  227.       end if
  228.       set the sourcePosition of pSelected to pOriginalSourcePosition
  229.     end tell
  230.   end if
  231. end
  232.  
  233. on setMemberEffects me
  234.   if count(pSelectedList) < 1 then
  235.     exit
  236.   end if
  237.   clearTests(me)
  238.   tell the stage
  239.     repeat while count(pSelectedList) <= 1
  240.       set m to getAt(ERROR, ERROR)
  241.       RemoveAllEffects(m)
  242.       repeat with i = 1 to count(pNewEffects)
  243.         set effect to getPropAt(pNewEffects, i)
  244.         set args to getAt(pNewEffects, i)
  245.         AddEffect(m, effect, args)
  246.       end repeat
  247.       -- ERROR: Expected eq or nteq!
  248.       set m to getAt(ERROR, ERROR + 1)
  249.       RemoveAllEffects(m)
  250.       repeat with i = 1 to count(pNewEffects)
  251.         set effect to getPropAt(pNewEffects, i)
  252.         set args to getAt(pNewEffects, i)
  253.         AddEffect(m, effect, args)
  254.       end repeat
  255.       -- ERROR: Expected eq or nteq!
  256.       set m to getAt(ERROR, ERROR + 1)
  257.       RemoveAllEffects(m)
  258.       repeat with i = 1 to count(pNewEffects)
  259.         set effect to getPropAt(pNewEffects, i)
  260.         set args to getAt(pNewEffects, i)
  261.         AddEffect(m, effect, args)
  262.       end repeat
  263.       -- ERROR: Expected eq or nteq!
  264.       set m to getAt(ERROR, ERROR + 1)
  265.       RemoveAllEffects(m)
  266.       repeat with i = 1 to count(pNewEffects)
  267.         set effect to getPropAt(pNewEffects, i)
  268.         set args to getAt(pNewEffects, i)
  269.         AddEffect(m, effect, args)
  270.       end repeat
  271.       -- ERROR: Expected eq or nteq!
  272.       repeat while ERROR <= (ERROR + 1)
  273.         set m to getAt(ERROR, ERROR)
  274.         RemoveAllEffects(m)
  275.         repeat with i = 1 to count(pNewEffects)
  276.           set effect to getPropAt(pNewEffects, i)
  277.           set args to getAt(pNewEffects, i)
  278.           AddEffect(m, effect, args)
  279.         end repeat
  280.         -- ERROR: Expected eq or nteq!
  281.         set m to getAt(ERROR, ERROR + 1)
  282.         RemoveAllEffects(m)
  283.         repeat with i = 1 to count(pNewEffects)
  284.           set effect to getPropAt(pNewEffects, i)
  285.           set args to getAt(pNewEffects, i)
  286.           AddEffect(m, effect, args)
  287.         end repeat
  288.         -- ERROR: Expected eq or nteq!
  289.         set m to getAt(ERROR, ERROR + 1)
  290.         RemoveAllEffects(m)
  291.         repeat with i = 1 to count(pNewEffects)
  292.           set effect to getPropAt(pNewEffects, i)
  293.           set args to getAt(pNewEffects, i)
  294.           AddEffect(m, effect, args)
  295.         end repeat
  296.         -- ERROR: Expected eq or nteq!
  297.         set m to getAt(ERROR, ERROR + 1)
  298.         RemoveAllEffects(m)
  299.         repeat with i = 1 to count(pNewEffects)
  300.           set effect to getPropAt(pNewEffects, i)
  301.           set args to getAt(pNewEffects, i)
  302.           AddEffect(m, effect, args)
  303.         end repeat
  304.         -- ERROR: Expected eq or nteq!
  305.         repeat while ERROR <= (ERROR + 1)
  306.           set m to getAt(ERROR, ERROR)
  307.           RemoveAllEffects(m)
  308.           repeat with i = 1 to count(pNewEffects)
  309.             set effect to getPropAt(pNewEffects, i)
  310.             set args to getAt(pNewEffects, i)
  311.             AddEffect(m, effect, args)
  312.           end repeat
  313.           -- ERROR: Expected eq or nteq!
  314.           set m to getAt(ERROR, ERROR + 1)
  315.           RemoveAllEffects(m)
  316.           repeat with i = 1 to count(pNewEffects)
  317.             set effect to getPropAt(pNewEffects, i)
  318.             set args to getAt(pNewEffects, i)
  319.             AddEffect(m, effect, args)
  320.           end repeat
  321.           -- ERROR: Expected eq or nteq!
  322.           set m to getAt(ERROR, ERROR + 1)
  323.           RemoveAllEffects(m)
  324.           repeat with i = 1 to count(pNewEffects)
  325.             set effect to getPropAt(pNewEffects, i)
  326.             set args to getAt(pNewEffects, i)
  327.             AddEffect(m, effect, args)
  328.           end repeat
  329.           -- ERROR: Expected eq or nteq!
  330.           set m to getAt(ERROR, ERROR + 1)
  331.           RemoveAllEffects(m)
  332.           repeat with i = 1 to count(pNewEffects)
  333.             set effect to getPropAt(pNewEffects, i)
  334.             set args to getAt(pNewEffects, i)
  335.             AddEffect(m, effect, args)
  336.           end repeat
  337.           -- ERROR: Expected eq or nteq!
  338.           repeat while ERROR <= (ERROR + 1)
  339.             set m to getAt(ERROR, ERROR)
  340.             RemoveAllEffects(m)
  341.             repeat with i = 1 to count(pNewEffects)
  342.               set effect to getPropAt(pNewEffects, i)
  343.               set args to getAt(pNewEffects, i)
  344.               AddEffect(m, effect, args)
  345.             end repeat
  346.             -- ERROR: Expected eq or nteq!
  347.             set m to getAt(ERROR, ERROR + 1)
  348.             RemoveAllEffects(m)
  349.             repeat with i = 1 to count(pNewEffects)
  350.               set effect to getPropAt(pNewEffects, i)
  351.               set args to getAt(pNewEffects, i)
  352.               AddEffect(m, effect, args)
  353.             end repeat
  354.             -- ERROR: Expected eq or nteq!
  355.             set m to getAt(ERROR, ERROR + 1)
  356.             RemoveAllEffects(m)
  357.             repeat with i = 1 to count(pNewEffects)
  358.               set effect to getPropAt(pNewEffects, i)
  359.               set args to getAt(pNewEffects, i)
  360.               AddEffect(m, effect, args)
  361.             end repeat
  362.             -- ERROR: Expected eq or nteq!
  363.             set m to getAt(ERROR, ERROR + 1)
  364.             RemoveAllEffects(m)
  365.             repeat with i = 1 to count(pNewEffects)
  366.               set effect to getPropAt(pNewEffects, i)
  367.               set args to getAt(pNewEffects, i)
  368.               AddEffect(m, effect, args)
  369.             end repeat
  370.             -- ERROR: Expected eq or nteq!
  371.           end repeat
  372.         end repeat
  373.       end repeat
  374.     end repeat
  375.   end tell
  376. end
  377.  
  378. on testStageMember me, obj
  379.   if not pUpdateStage then
  380.     exit
  381.   end if
  382.   if voidp(pSelected) then
  383.     exit
  384.   end if
  385.   tell the stage
  386.     TestEffect(pSelected, the peffect of obj, makePropertyList(obj))
  387.   end tell
  388. end
  389.  
  390. on tempStageMember me, obj, effect, args
  391.   setaProp(pNewEffects, effect, makePropertyList(obj))
  392.   if not pUpdateStage then
  393.     exit
  394.   end if
  395.   if voidp(pSelected) then
  396.     exit
  397.   end if
  398.   tell the stage
  399.     TestEffect(pSelected, effect, args)
  400.     updateStage()
  401.   end tell
  402. end
  403.  
  404. on updateEffects me, obj
  405.   setaProp(pNewEffects, the peffect of obj, makePropertyList(obj))
  406. end
  407.  
  408. on lingoToClipboard me, obj
  409.   set effect to string(the peffect of obj)
  410.   set text to effect & "( sprite yourSprite," && makePropertyList(obj) && ")"
  411.   put text
  412.   put text into field "Lingo To Clipboard"
  413.   copyToClipBoard(member "Lingo To Clipboard")
  414. end
  415.  
  416. on clearTests me
  417.   if voidp(pSelected) then
  418.     exit
  419.   end if
  420.   tell the stage
  421.     EndAllTests(pSelected)
  422.   end tell
  423. end
  424.  
  425. on getSourceNameAndCast me
  426.   tell the stage
  427.     set pSource to the sourcemember of pSelected
  428.     set pOriginalSource to the sourcemember of pSelected
  429.     set pSourcePosition to the sourcePosition of pSelected
  430.     set pOriginalSourcePosition to the sourcePosition of pSelected
  431.     set pAlphaOnly to the alphaOnly of pSelected
  432.     set pRelToSprite to the sourceRelToSprite of pSelected
  433.     set pOriginalRelToSprite to the sourceRelToSprite of pSelected
  434.     if voidp(pSource) or (pSource = 0) then
  435.       set pSource to void
  436.       set pSourceMember to EMPTY
  437.       set pSourceCast to EMPTY
  438.     else
  439.       set pSourceMember to the name of pSource
  440.       set pSourceCast to the name of castLib the castLibNum of pSource
  441.     end if
  442.   end tell
  443. end
  444.  
  445. on validMember me
  446.   return not voidp(pSelected)
  447. end
  448.  
  449. on SetSourceMember me, pSource0
  450.   if voidp(pSource0) then
  451.     exit
  452.   end if
  453.   set pSource to pSource0
  454.   if not voidp(pSelected) then
  455.     tell the stage
  456.       set pSourceMember to the name of pSource
  457.       set pSourceCast to the name of castLib the castLibNum of pSource
  458.       set the sourcemember of member pSelected to pSource
  459.     end tell
  460.   end if
  461. end
  462.  
  463. on newSourcePosition me, pos
  464.   set pSourcePosition to pos
  465.   if not voidp(pSelected) then
  466.     tell the stage
  467.       set the sourcePosition of pSelected to pos
  468.     end tell
  469.   end if
  470. end
  471.  
  472. on setSourceCast me, pSourceCast0
  473.   set pSourceCast to pSourceCast0
  474.   set pSource to void
  475.   set pSouceMember to EMPTY
  476.   tell the stage
  477.     repeat with c = 1 to the number of castMembers of castLib pSourceCast
  478.       if the type of member c of castLib pSourceCast = #bitmap then
  479.         set pSource to member c of castLib pSourceCast
  480.         set pSourceMember to the name of pSource
  481.         set the sourcemember of member pSelected to pSource
  482.         exit
  483.       end if
  484.     end repeat
  485.   end tell
  486. end
  487.  
  488. on checkBox me, refcon, status
  489.   set pUpdateStage to status
  490. end
  491.  
  492. on popupAddEffect me, sNum
  493.   global fxDisplayMember, fxWindow
  494.   set where to point(the right of sprite sNum, the top of sprite sNum)
  495.   set choice to PopUpMenu(fxDisplayMember, where, pAllEffectsList)
  496.   if choice > 0 then
  497.     set effect to getAt(pAllEffectsList, choice)
  498.     goToEffect(me, effect)
  499.   end if
  500. end
  501.  
  502. on setMemory me, n
  503.   set fx to [#effects: pNewEffects]
  504.   addProp(fx, #drawMethod, pDrawMethod)
  505.   addProp(fx, #sourcemember, pSource)
  506.   addProp(fx, #sourcePosition, pSourcePosition)
  507.   set text to GetPref("AlphaMania FX Memory")
  508.   if voidp(text) then
  509.     set text to EMPTY
  510.   end if
  511.   put string(fx) into line n of text
  512.   SetPref("AlphaMania FX Memory", text)
  513.   beep(1)
  514. end
  515.  
  516. on getMemory me, n
  517.   set text to GetPref("AlphaMania FX Memory")
  518.   if voidp(text) then
  519.     set text to EMPTY
  520.   end if
  521.   set fx to value(line n of text)
  522.   if listp(fx) then
  523.     if count(fx) > 3 then
  524.       setDrawMethod(me, getProp(fx, #drawMethod))
  525.       SetSourceMember(me, getProp(fx, #sourcemember))
  526.       newSourcePosition(me, getProp(fx, #sourcePosition))
  527.       set pNewEffects to getProp(fx, #effects)
  528.       updateFXtextlist(me)
  529.       go("General Member Settings")
  530.       beep(2)
  531.     end if
  532.   end if
  533. end
  534.  
  535. on Release
  536.   set released to 1
  537. end
  538.